<?php 
session_start();
require_once 'header.php';
function __autoload($className)
	{
    	require_once('class/' . $className . '.class.php');
	}
if(!empty($_GET))
{
	$agent=strval($_GET["agent"]);
	$vote=strval($_GET["vote"]);
	$ccId=intval($_GET["ccid"]);
	$userId=session::getuserid();
	if($vote=='good')
	{
		$good=1;
		$bad=0;
	}
	else if($vote=='bad')
	{
		$bad=1;
		$good=0;
	}
	$check=verify::check($agent);
	$checkPermission=user::checkpermission("ccinfo", "userid=$userId", "ccid=$ccId");
	if(($check==0)&&($checkPermission==1))
	{
		
		
		$update=database::Update("agent",array(
		'agent_class' => $agent
		),array(
		'good_feetback' => array( "good_feetback + {$good}"),
		'bad_feetback' => array( "bad_feetback + {$bad}")
		)
		);
		$updateSold=database::Update("ccinfo",array(
		'ccid' => $ccId
		),array(
		'is_vote' => "Y"
		));
	}
	else
	{
		echo "erro";
	}
}

?>
